<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    	<h1>这是我的第一个Session登录</h1>
    	<img src="https://gss0.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/zhidao/wh%3D800%2C450/sign=520e7d79d133c895a62b9073e1235fc4/0823dd54564e92588c238c009482d158cdbf4ecc.jpg">
    	<br>
    	<%
    	   String userName = "";
    		Cookie[] cs = request.getCookies();
    		if(cs != null){
    			for(Cookie c : cs){
    				if("userName".equals(c.getName())) {
    					userName = c.getValue();
    				}
    			}
    		}
    	 %>
    	<%
    		String message = "";
    		String msg = (String) request.getAttribute("msg");
    		if(msg != null){
    			message = msg;
    		}
    	 %>
    	 <font color="red"><b><%=message %></b></font>
	<br>
	<form action="/LiMing/LoginServlet" Method="post">
		用户名：<input type="text" name="userName" value="<%=userName %>"/><br> 
		密          码：<input  type="password" name="keyWord" /><br> 
		<input type="submit" value="提交" />
		<% %>
	</form>
  </body>
</html>
